<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pixbufs</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK 3 参考手册">
<link rel="up" href="reference.html" title="API参考">
<link rel="prev" href="gdk3-Points-Rectangles-and-Regions.html" title="Points and Rectangles">
<link rel="next" href="gdk3-Colors.html" title="Colors">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk3-Points-Rectangles-and-Regions.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK 3 参考手册</th>
<td><a accesskey="n" href="gdk3-Colors.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk3-Pixbufs.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk3-Pixbufs.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk3-Pixbufs"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk3-Pixbufs.top_of_page"></a>Pixbufs</span></h2>
<p>Pixbufs — Functions for obtaining pixbufs</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk3-Pixbufs.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk/gdk.h&gt;

<a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk3-Pixbufs.html#gdk-pixbuf-get-from-window" title="gdk_pixbuf_get_from_window ()">gdk_pixbuf_get_from_window</a>          (<em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow" title="GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);
<a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         <a class="link" href="gdk3-Pixbufs.html#gdk-pixbuf-get-from-surface" title="gdk_pixbuf_get_from_surface ()">gdk_pixbuf_get_from_surface</a>         (<em class="parameter"><code><a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> *surface</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk3-Pixbufs.description"></a><h2>Description</h2>
<p>
Pixbufs are client-side images. For details on how to create
and manipulate pixbufs, see the <a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> API documentation.
</p>
<p>
The functions described here allow to obtain pixbufs from
<a href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindows</span></a> and cairo surfaces.
</p>
</div>
<div class="refsect1">
<a name="gdk3-Pixbufs.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="gdk-pixbuf-get-from-window"></a><h3>gdk_pixbuf_get_from_window ()</h3>
<pre class="programlisting"><a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_get_from_window          (<em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow" title="GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);</pre>
<p>
Transfers image data from a <a class="link" href="gdk3-Windows.html#GdkWindow" title="GdkWindow"><span class="type">GdkWindow</span></a> and converts it to an RGB(A)
representation inside a <a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>. In other words, copies
image data from a server-side drawable to a client-side RGB(A) buffer.
This allows you to efficiently read individual pixels on the client side.
</p>
<p>
This function will create an RGB pixbuf with 8 bits per channel with
the same size specified by the <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> arguments. The pixbuf
will contain an alpha channel if the <em class="parameter"><code>window</code></em> contains one.
</p>
<p>
If the window is off the screen, then there is no image data in the
obscured/offscreen regions to be placed in the pixbuf. The contents of
portions of the pixbuf corresponding to the offscreen region are undefined.
</p>
<p>
If the window you're obtaining data from is partially obscured by
other windows, then the contents of the pixbuf areas corresponding
to the obscured regions are undefined.
</p>
<p>
If the window is not mapped (typically because it's iconified/minimized
or not on the current workspace), then <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned.
</p>
<p>
If memory can't be allocated for the return value, <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned
instead.
</p>
<p>
(In short, there are several ways this function can fail, and if it fails
 it returns <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>; so check the return value.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>window</code></em> :</span></p></td>
<td>Source window</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_x</code></em> :</span></p></td>
<td>Source X coordinate within <em class="parameter"><code>window</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_y</code></em> :</span></p></td>
<td>Source Y coordinate within <em class="parameter"><code>window</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>Width in pixels of region to get</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>Height in pixels of region to get</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A newly-created pixbuf with a reference
count of 1, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-from-surface"></a><h3>gdk_pixbuf_get_from_surface ()</h3>
<pre class="programlisting"><a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *         gdk_pixbuf_get_from_surface         (<em class="parameter"><code><a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> *surface</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> src_y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);</pre>
<p>
Transfers image data from a <a href="../cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> and converts it to an RGB(A)
representation inside a <a href="../gdk-pixbuf/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>. This allows you to efficiently read
individual pixels from cairo surfaces. For <a href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindows</span></a>, use
<a class="link" href="gdk3-Pixbufs.html#gdk-pixbuf-get-from-window" title="gdk_pixbuf_get_from_window ()"><code class="function">gdk_pixbuf_get_from_window()</code></a> instead.
</p>
<p>
This function will create an RGB pixbuf with 8 bits per channel.
The pixbuf will contain an alpha channel if the <em class="parameter"><code>surface</code></em> contains one.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>surface</code></em> :</span></p></td>
<td>surface to copy from</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_x</code></em> :</span></p></td>
<td>Source X coordinate within <em class="parameter"><code>surface</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_y</code></em> :</span></p></td>
<td>Source Y coordinate within <em class="parameter"><code>surface</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>Width in pixels of region to get</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>Height in pixels of region to get</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A newly-created pixbuf with a reference
count of 1, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>